package com.wzdigit.wms.basic.enums.inv;

import java.util.*;

import com.wzdigit.wms.basic.enums.BaseEnum;


/**
 * 冻结/解冻方式
 * @author Administrator
 *
 */
public enum HoldHeaderWayEnum implements BaseEnum{

	ASN("H01_1", "按送货单", "Way"), 
	OQC("H01_2", "按检验单", "Way"), 
	SKU("H01_3", "按料号", "Way"), 
	LOTNO("H01_4", "按批次", "Way"), 
	HOLDNO("H02_1", "按冻结单", "Way");
	
	/**
	 * 枚举值
	 */
	public String code;

	/**
	 * 枚举名称
	 */
	public String enumName;

	/**
	 * 枚举实体类属性描述
	 *
	 * @return
	 */
	public String description;
	
	
	HoldHeaderWayEnum(String enumName, String description) {
		this.enumName = enumName;
		this.description = description;
	}
	
	HoldHeaderWayEnum(String code, String enumName, String description) {
		this.code = code;
		this.enumName = enumName;
		this.description = description;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	public String getEnumName() {
		return enumName;
	}

	public void setEnumName(String enumName) {
		this.enumName = enumName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static HoldHeaderWayEnum getEnumByCode(String enumCode) {
		HoldHeaderWayEnum[] values = HoldHeaderWayEnum.values();
		HoldHeaderWayEnum samplingEnum = null;

		for (HoldHeaderWayEnum value : values) {
			if (Objects.equals(value.getCode(), enumCode)) {
				samplingEnum = value;
			}
		}
		return samplingEnum;
	}

	public static HoldHeaderWayEnum getEnumByName(String enumName) {
		HoldHeaderWayEnum[] values = HoldHeaderWayEnum.values();
		HoldHeaderWayEnum repairEnum = null;

		for (HoldHeaderWayEnum value : values) {
			if (Objects.equals(value.getEnumName(), enumName)) {
				repairEnum = value;
			}
		}
		return repairEnum;
	}

	public static Map<String, String> getEnumByDescription(String enumDescription) {
		Map<String, String> enumMap = new HashMap<>();

		HoldHeaderWayEnum[] values = HoldHeaderWayEnum.values();
		for (HoldHeaderWayEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)) {
				enumMap.put(value.getCode(), value.getEnumName());
			}
		}
		return enumMap;
	}
	
	public static String getCodeByEnumNameAndDescription(String enumName, String enumDescription) {
		HoldHeaderWayEnum[] values = HoldHeaderWayEnum.values();
		for (HoldHeaderWayEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)
					&& Objects.equals(value.getEnumName(), enumName)) {
				return value.getCode();
			}
		}
		return null;
	}

	
	public static List<Map<String, Object>> getEnumListByDescription(String enumDescription) {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		HoldHeaderWayEnum[] values = HoldHeaderWayEnum.values();
		for (HoldHeaderWayEnum value : values) {
			if (Objects.equals(value.getDescription(), enumDescription)) {
				Map<String, Object> enumMap = new HashMap<String, Object>(2);
				enumMap.put("code", value.getCode());
				enumMap.put("name", value.getEnumName());
				list.add(enumMap);
			}
		}
		return list;
	}
	
	public static List<Map<String, Object>> getEnumListByDescription() {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		HoldHeaderWayEnum[] values = HoldHeaderWayEnum.values();
		for (HoldHeaderWayEnum value : values) {
			Map<String, Object> enumMap = new HashMap<String, Object>(2);
			enumMap.put("code", value.getCode());
			enumMap.put("name", value.getEnumName());
			list.add(enumMap);
		}
		return list;
	}
}
